<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:63:"F:\Yel_projuct\officiaWeb\public/tpl/admin\admin_user\edit.html";i:1563457545;s:59:"F:\Yel_projuct\officiaWeb\public\tpl\admin\public\base.html";i:1563270889;}*/ ?>
<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>后台管理-修改管理员</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="\static\x-admin/css/font.css">
        <link rel="stylesheet" href="\static\x-admin/css/xadmin.css">
        <script type="text/javascript" src="\static/resources/js/jquery/jquery-2.0.0.min.js"></script>
        <script type="text/javascript" src="\static\x-admin/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="\static\x-admin/js/xadmin.js"></script>

        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <script>
        // 是否开启刷新记忆tab功能
        // var is_remember = false;
    </script>
    <style type="text/css"></style>
    <body>
    	
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
          <div class="layui-form-item">
              <label for="account" class="layui-form-label">
                  <span class="x-red">*</span>账号
              </label>
              <div class="layui-input-inline">
                  <input type="text" name="ids" value="<?php echo $userInfo['id']; ?>" hidden="hidden"> 
                  <input type="text" id="account" name="account" value="<?php echo $userInfo['account']; ?>" disabled="disabled" required="" lay-verify="account"
                  autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>账号不允许修改
              </div>
          </div>
          <div class="layui-form-item">
              <label for="phone" class="layui-form-label">
                  <span class="x-red">*</span>手机
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="phone" name="phone" value="<?php echo $userInfo['phone']; ?>" required="" lay-verify="phone"
                  autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>将会成为您唯一的登入名
              </div>
          </div>
          <div class="layui-form-item">
              <label for="email" class="layui-form-label">
                  <span class="x-red">*</span>邮箱
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="email" name="email" value="<?php echo $userInfo['email']; ?>" required="" lay-verify="email"
                  autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="name" class="layui-form-label">
                  <span class="x-red">*</span>用户名
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="name" name="name" value="<?php echo $userInfo['name']; ?>" required="" lay-verify="name"
                  autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="group" class="layui-form-label"><span class="x-red">*</span>角色</label>
              <div class="layui-input-block">
                <?php if(is_array($userGroup) || $userGroup instanceof \think\Collection || $userGroup instanceof \think\Paginator): $i = 0; $__LIST__ = $userGroup;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                <input type="radio" name="group" value="<?php echo $v['id']; ?>" <?php if($userInfo['admin_user_group_id'] == $v['id']): ?> checked="checked" <?php endif; ?> lay-skin="primary" title="<?php echo $v['name']; ?>">
                <?php endforeach; endif; else: echo "" ;endif; ?>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="password" class="layui-form-label">
                  <span class="x-red">*</span>密码
              </label>
              <div class="layui-input-inline">
                  <input type="password" id="password" name="password" lay-verify="password"
                  autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  6到16个字符（不输入则不修改）
              </div>
          </div>
          <div class="layui-form-item">
              <label for="repassword" class="layui-form-label">
                  <span class="x-red">*</span>确认密码
              </label>
              <div class="layui-input-inline">
                  <input type="password" id="repassword" name="repassword" lay-verify="repassword"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  type="button" class="layui-btn" lay-filter="add" lay-submit="">
                  修改
              </button>
          </div>
      </form>
    </div>
</div>
        

        
    <script>
      layui.use(['form', 'layer'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
            layer = layui.layer;

            //自定义验证规则
            form.verify({
                account: function(value) {
                    if (value.length < 2) {
                        return '昵称至少得2个字符！';
                    }
                    if (value.length >= 25) {
                        return '昵称至多得25个字符！';
                    }
                },
                phone: [/^1[3456789]\d{9}$/, '手机号码格式'],
                email: [/^[_a-z0-9-]*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/, '邮箱格式错误'],
                repassword: function(value) {
                    let pwd = $('#password').val();
                    let repwd = $('#repassword').val();
                    let reg = /^(.+){6,12}$/;
                    if(pwd){
                      if(!reg.test(pwd)){
                        return '密码必须6到12位';
                      }
                    }
                    if(pwd||repwd){
                      if (pwd != repwd) {
                          return '两次密码不一致';
                      }
                    }
                    
                    //验证是否有选择用户组
                    if(!$('input[name="group"]:checked').val()){
                       return '请选择角色';
                    }
                }
            });

            //监听提交
            form.on('submit(add)',
            function(data) {
                console.log(data);
                $.post("<?php echo url('admin/AdminUser/edit'); ?>",data.field,function(e){
                  if(e.code == 200){
                    //发异步，把数据提交给php
                      layer.alert(e.msg, {icon: 6},function () {
                          //关闭当前frame
                            xadmin.close();
                            // 可以对父窗口进行刷新 
                            xadmin.father_reload();
                      });
                      return false;
                  }
                  layer.alert(e.msg, {
                      icon: 5
                  });
                  return false;
              });
            });

        });</script>
    <script>var _hmt = _hmt || []; (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();</script>

    </body>
</html>
